<%@ taglib uri="/WEB-INF/tld/struts-html.tld"   prefix="html"%>

<%@page import="java.util.Iterator,org.tigris.atlas.quizme.client.form.AnswerForm,org.tigris.atlas.quizme.transfer.Answer,org.tigris.atlas.quizme.transfer.Question,org.tigris.atlas.quizme.client.utils.Constants"%>
<div class="tab-page">
		<div id="subPages" class="disabled link-row">
			<table class="wide-table">
				<tr>
					<td width="100%" height="10">
							<H2>Answer Detail</H2>
					</td>
				</tr>
			</table>
		</div>
		
	<table cellpadding="0" cellspacing="0" border="0">
	<tr>
   <td colspan="2">
   <%
   		AnswerForm answerForm = (AnswerForm)request.getAttribute("SelectedAnswer");
		String sQuestionNumber = (String)request.getAttribute(Constants.QUESTION_INDEX_KEY);
		int iQuestionNumber = Integer.parseInt(sQuestionNumber); 
		Question q = ((Question)request.getAttribute(Constants.CURRENT_QUESTION_KEY));
		java.util.List answers = (java.util.List)request.getSession().getAttribute(Constants.CURRENT_ANSWERS_KEY);;
		Iterator i = answers.iterator();
	%>
	


<p ><img src="<html:rewrite page='/images/feedback-success.gif'/>"> Denotes the correct answer
<table><tr><td bgcolor="#9065FF">Rows highlighted this color are your selected answers.</td></tr></table></p>
	<P><H2>Question <%= iQuestionNumber+1 %></H2></P>
	<p><B><%= q.getQuestion()  %></B></div></P>
	
	<form name="DetailsForm" action="<html:rewrite page='/backToResults.do'/>">
	<table border="1">
	<% 
		int answerNumber = 0;
		while(i.hasNext()){
			Answer answer = (Answer)i.next();
	%>
	<tr> 
		<td>
		<%
			if(answer.getCorrect().booleanValue()){
		%>
		<img src="<html:rewrite page='/images/feedback-success.gif'/>">
		<%
			}
		%>
		</td>
		<td><%=answerNumber+1 %></td>
		<td <%if(answerForm.getAnswer().indexOf(""+(answerNumber)) != -1){%>bgcolor="#9065FF"<%}%>><%= answer.getAnswer() %></td>
	</tr>
	<%answerNumber++;} %>
	</table>
	</form>
<table width="100%" border="0">
		<tr>
			<td colspan="2">
				<button name="save" id="5" enabledMode="" accesskey="N"
					class="imageButton" type="button"
					onclick="javascript:document.DetailsForm.submit()" onmouseout="javascript:className='imageButton';" onmouseover="javascript:className='activeImageButton';" >
					<IMG src="<html:rewrite page='/images/goto.gif'/>" alt="Next Question"><IMG src="<html:rewrite page='/images/space.gif'/>" height="20" width="1">
					<span class="underline">B</span>ack
				</button>
			</td>
		</tr>
	</table>
	
<BR>
</td>
</tr>
</table>